
<div style='margin:auto'>
<?php


   echo "<span class='postTitle'>Tag: ".$com1."</span>";
echo "<div class='post2'><b>Description</b>";
 if ($session->check('Auth.User.id'))
 echo "<span style='float:right;'><a href='/urp/tags/edit_description/".$com1."' onclick='return editDescription()'>Edit Description</a></span>";
echo "<br/>";
echo nl2br($description);

echo "<div id='editDescription'>";
echo $this->Form->create('Tag', array('action'=>'edit_description'));
echo $this->Form->input('Tag.tag', array('type'=>'text', 'style'=>'display:none', 'label'=>'', 'default'=>$com1));
echo $this->Form->input('Tag.description', array('type'=>'text', 'label'=>'Description','default'=>$description));
echo $this->Form->end('Edit Description');
echo "</div>";
echo "</div>";
if (!isset($setparent1))
    $setparent1="";
if (!isset($setparent))
    $setparent="";

echo "<div class='post2'>";
echo "<b>Parent Tag: </b>";
if ($session->check('Auth.User.id'))
echo "<span style='float:right;'><a href='/urp/tags/editparent/".$com1."' onclick='return editParents()' style='text-align:right;'> Edit Parent</a></span>";
echo "<br/>";
if (isset($parent)) {
//echo "<a href='/urp/tags/view/".$parent."'>".$parent."</a><br/><br/>";
    foreach ($parent as $parent1)
        echo "<a href='/urp/tags/view/".$parent1['tags']['tag']."'>".$parent1['tags']['tag']."</a>, ";
    echo "<br/><br/>";
}
else
    echo "None.<br/><br/>";
echo "<div style='display:none' id='editParents'>";
echo $this->Form->create('Tag', array('action'=>'editparents'));
echo $this->Form->input('Tag.tag', array('type'=>'text', 'label'=>'', 'default'=>$com1, 'style'=>'display:none'));
echo $this->Form->input('Parent.tag', array('label'=>'Parents','type'=>'text', 'default'=>$setparent1));
echo $this->Form->end('Edit Parents');
echo "</div>";
echo "<b>Child Tags:</b> ";
 
echo "<span style='float:right;'><a href='#' onclick='return showChildren(this)'>Show All</a> ";
if ($session->check('Auth.User.id'))
    echo  "<a href='/urp/tags/setparent/".$com1."' onclick='return setChildren()' style='text-align:right;'> Edit Children</a></span>";
else
    echo "</span>";
//echo "<div style='overflow-x:scroll'>";
echo "<div id='children'>";
echo $this->element("tree_tag");
echo "</div>";
//echo "</div>";

echo "<div style='display:none' id='setChildren'>";
echo $this->Form->create('Tag', array('action'=>'setparent', 'id'=>'setparent'));
echo $this->Form->input('Parent.tag', array('type'=>'text', 'label'=>'', 'default'=>$com1, 'style'=>'display:none'));
echo $this->Form->input('Tag.tag', array('label'=>'First-Order Children','type'=>'text', 'default'=>$setparent));
echo $this->Form->end('Edit Children');
echo "</div>";
echo "</div>";
echo "<div class='post2'>";
echo "<b>Recently Added:</b> <br/>";
echo "</div>";



?>
</div>